package cn.liujianbo.easycode.common.enums;

import cn.liujianbo.easycode.common.enums.common.NameValueEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author 刘建波
 * @date 2022-01-28 09:44
 */
@AllArgsConstructor
@Getter
public enum ErrorEnum implements NameValueEnum<Integer> {

    /**
     * 服务端错误
     */
    EXCEPTION(500, "系统内部错误！", "exception_msg.Exception"),
    HTTP_REQUEST_METHOD_NOT_SUPPORTED_EXCEPTION(500, "请求方式错误！", "exception_msg.HttpRequestMethodNotSupportedException"),
    HTTP_MESSAGE_NOT_READABLE_EXCEPTION(500, "前台数据读取异常！", "exception_msg.HttpMessageNotReadableException"),
    ILLEGAL_ARGUMENT_EXCEPTION(500, "参数校验失败！", "exception_msg.IllegalArgumentException"),

    /**
     * 用户端错误
     */
    ILLEGAL_REQUEST(41010, "非法请求！", "business_msg.ILLEGAL_REQUEST"),
    REPEAT_SUBMIT(41011, "重复提交！", "business_msg.REPEAT_SUBMIT"),

    NO_DATA_IS_FOUND(41020, "没有查询到数据！", "business_msg.NO_DATA_IS_FOUND"),
    DATA_ALREADY_EXISTS(41021, "数据已存在！", "business_msg.DATA_ALREADY_EXISTS"),

    TOKEN_DENIED(901, "token 校验失败", "business_msg.TOKEN_DENIED"),
    PERMISSION_DENIED(41101, "用户没有权限！", "business_msg.PERMISSION_DENIED"),

    ILLEGAL_PARAMETER(41151, "非法参数！", "business_msg.ILLEGAL_PARAMETER"),

    /**
     * 系统内部配置错误
     */
    SYSTEM_CONFIG_ERROR(43101, "系统内部配置错误！", "business_msg.SYSTEM_CONFIG_ERROR");

    private Integer value;
    private String name;
    private String i18nKey;
}
